
	
*============================================ MAIN TABLES =================================================================*


	
**------------------------------------------------
** TABLE 1,  PANEL A
**------------------------------------------------
	
	
	// Use the right analysis sample 
	use "$repfinaldata/matchedloans_finalsample.dta", clear
	// format the variables 
	replace OriginalCreditScore = . if I_mi_credit==1
	replace OriginalLTV = OriginalLTV * 100
	replace OriginalInterestRate = OriginalInterestRate*100 
	replace OriginalLoanAmount = OriginalLoanAmount / 1000 
	replace OriginalPropertyValue = OriginalPropertyValue / 1000 
	replace r2 = r2 / 1000 
	replace FirstMortg = FirstMortg*100 
	replace SecondHome = SecondHome * 100
	replace LowGrade = LowGrade * 100
	replace FHA_VA = FHA_VA * 100 
	replace FullDocument = FullDocument*100
	replace Jumbo = Jumbo * 100
	replace I_del = I_del*100 


	// create labels 
	label var OriginalLTV "LTV (\%)"
	label var OriginalInterestRate "Interest Rate (\%)"
	label var OriginalLoanAmount "Loan Amount (\\$000s)"
	label var OriginalPropertyValue "Property Value (\\$000s)"
	label var OriginalCreditScore "Credit Score"
	label var OriginalTerm "Maturity (months)"
	label var hmda_app_income "Applicant Annual Income (\\$000s)"
	label var DTIH "DTI (\%)"
	label var CLTV "Combined LTV (\%)"
	label var FirstMortg "First Mortgage Share (\%)"
	label var SecondHome "Second Home Share (\%)"
	label var LowGrade "Low Grade Share (\%)"
	label var FHA_VA "FHA or VA Share (\%)"
	label var FullDocument "Full Document Share (\%)"
	label var JumboAtOrigination "Jumbo Loan Share (\%)"
	label var I_del "Delinquent Share (\%)"
	label var r2 "Replacement Cost (\\$000s)"
	label var rs_Building "Building Size (Square Feet)"
	label var I_r2 "CapBinds (Yes/No)"
	

	est drop _all
	eststo: estpost summ $loan_descript if I_SHFA==1 
	local loan_shfa_N: di %9.0fc e(N) 
	eststo: estpost summ $loan_descript if I_SHFA==0  
	local loan_noshfa_N: di %9.0fc e(N) 
	
	esttab using "$repoutput/summstats_loan.txt",  cells("mean(fmt(a2)) sd(fmt(a2))") mtitle("FloodZone" "NonFloodZone" ) label replace
	
	esttab  using "$repoutput/summstats.tex", tex replace ///
		cells("mean(fmt(a2)) sd(fmt(a2))") ///
		mtitle("FloodZone" "NonFloodZone" ) /// ///
		refcat(OriginalCreditScore "\hline \textit{Panel A: Loan Characteristics}", nolabel) ///
		nodepvars nonumbers label frag nolines noobs ///
		postfoot("Observations &\multicolumn{2}{c}{`loan_shfa_N'} & \multicolumn{2}{c}{`loan_noshfa_N'} \\")
		
		
**--------------------------------------------------------------------------------------------------------------------
** TABLE 1, PANEL B
**------------------------------------------------
	use "$repfinaldata/matchedloans_finalsample.dta", clear
	keep ZIP year takeup* openfema* acs* NonFlood* Flood* All* 
	cap noi drop FloodZone_x //new 
	gen takeup_overall = openfema_total / acs_num_hunits 
 	duplicates drop

	gen NonFlood_claimprob = NonFlood_count_claim / openfema_noSHFA 
	gen Flood_claimprob = Flood_count_claim / openfema_SHFA 
	gen All_claimprob = All_count_claim / openfema_total 
	rename takeup_overall All_takeup
	rename takeup_SHFA Flood_takeup
	rename takeup_noSHFA NonFlood_takeup 
	
	drop *_count* 
	cap noi drop FloodZone_x //new 
	keep ZIP year All* Flood* NonFlood* 
	rename *_mean_claim* *_meanclaim 
	rename *_mean_buildingvalue *_meanbuildingvalue
	rename NonFlood_* *_NonFlood
	rename Flood_* *_Flood
	rename All_* *_All 
	
	reshape long meanclaim meanbuildingvalue claimprob takeup, i(ZIP year) j(shfagroup) string
	
	replace takeup = takeup * 100
	replace claimprob = claimprob * 100 	
	replace meanclaim = meanclaim / 1000
	replace meanbuilding = meanbuilding/1000
	label var takeup "Takeup Rate (\%)"
	label var claimprob "Claim Probability (\%)"
	label var meanclaim "Claim (\\$000s)"
	label var meanbuildingvalue "Assessed Building Value (\\$000s)"
	
	
	est drop _all 
	eststo: estpost summ takeup claimprob meanclaim meanbuilding if shfagroup=="_Flood"
	local zip_shfa_N: di %9.0fc e(N) 
	eststo: estpost summ takeup claimprob meanclaim meanbuilding  if shfagroup=="_NonFlood"
	local zip_noshfa_N: di %9.0fc e(N)	
	esttab  using "$repoutput/summstats_zip.txt", ///
		cells("mean(fmt(a2)) sd(fmt(a2))") mtitle("FloodZone" "NonFloodZone" ) label replace
	
	esttab using "$repoutput/summstats.tex", tex append ///
		cells("mean(fmt(a2)) sd(fmt(a2))") ///
		nomtitle ///
		refcat(takeup "\hline \textit{Panel B: Flood Insurance Characteristics}", nolabel) ///
		collabels(none) /// 
		nodepvars nonumbers label frag ///
		nolines noobs ///
		postfoot("Observations (Zip-Year)&\multicolumn{2}{c}{`zip_shfa_N'} & \multicolumn{2}{c}{`zip_noshfa_N'}")
		
	

**-----------------------------------------------------------------------
** TABLE 2
**--------------------------------------------------------------------------

	use "$repfinaldata/matchedloans_finalsample.dta", clear 	
	cap noi egen fegroup = group(FIPS ZIP year)
	label var I_SHFA_final FloodZone 
			
	label var OriginalLTV "Loan-to-Value Ratio"
	label var OriginalInterestRate "Interest Rate"
	label var I_del "Delinquency"
	label var I_90 "Delinquency"
	
	
	*Panel A

	
	est drop _all
	eststo: reg OriginalLTV I_SHFA_final, ///
		cl(FIPS) 	
		estadd local ZipYearFE "N"
		estadd local Controls "N"
	
	eststo: reg OriginalInterestRate I_SHFA_final, ///
		cl(FIPS) 	
		estadd local ZipYearFE "N"
		estadd local Controls "N"
		
		
	eststo: reg I_del  I_SHFA_final, ///
		cl(FIPS) 	
		estadd local ZipYearFE "N"
		estadd local Controls "N"
	
	esttab using "$repoutput/descriptivefacts.tex", b(4) se(4) ar2(2) keep(I_SHFA_final) ///
		star(* 0.10 ** 0.05 *** 0.01) ///
		posthead("[1em]\midrule\multicolumn{4}{l}{\textit{Panel A: Excludes Controls and Zip-Year Fixed Effects}} \\") ///  
		label  replace  nolines noobs frag
	
	*Panel B
	
	est drop _all 
	
	eststo: reghdfe OriginalLTV I_SHFA_final, ///
		cl(FIPS) absorb(fegroup)		
		estadd local ZipYearFE "Y"
		estadd local Controls "N"
		
			
	eststo: reghdfe OriginalInterestRate I_SHFA_final, ///
		cl(FIPS) absorb(fegroup)		
		estadd local ZipYearFE "Y"
		estadd local Controls "N"
		
	eststo: reghdfe I_del I_SHFA_final, ///
		cl(FIPS) absorb(fegroup)		
		estadd local ZipYearFE "Y"
		estadd local Controls "N"
		
	esttab using "$repoutput/descriptivefacts.tex", b(4) se(4) ar2(2) keep(I_SHFA_final) ///
		star(* 0.10 ** 0.05 *** 0.01) ///
		prehead("[1em]\midrule\multicolumn{4}{l}{\textit{Panel B: Excludes Controls, Includes Zip-Year Fixed Effects}} \\") /// 
		label append  nolines noobs nodepvar nonumber  nomtitles frag
		
		
	*Panel C
	
	
	est drop _all 
	
	eststo: reg OriginalLTV I_SHFA_final ///
		OriginalCreditScore_reg I_mi_CreditScore log_OriginalPropertyValue log_hmda_income, ///
		cl(FIPS) 		
		estadd local ZipYearFE "N"
		estadd local Controls "Y"
		
	eststo: reg OriginalInterestRate I_SHFA_final ///
		OriginalCreditScore_reg I_mi_CreditScore log_OriginalPropertyValue log_hmda_income, ///
		cl(FIPS) 		
		estadd local ZipYearFE "N"
		estadd local Controls "Y"
		
	eststo: reg I_del I_SHFA_final ///
		OriginalCreditScore_reg I_mi_CreditScore log_OriginalPropertyValue log_hmda_income, ///
		cl(FIPS) 		
		estadd local ZipYearFE "N"
		estadd local Controls "Y"
		
			
	esttab using "$repoutput/descriptivefacts.tex", b(4) se(4) ar2(2) keep(I_SHFA_final) ///
		star(* 0.10 ** 0.05 *** 0.01) ///
		prehead("[1em]\midrule\multicolumn{4}{l}{\textit{Panel C: Includes Controls, Excludes Zip-Year Fixed Effects}} \\") /// 
		label append  nolines noobs nodepvar nonumber  frag nomtitles 
		
	*Panel D
	
	
	est drop _all 
	
	eststo: reghdfe OriginalLTV I_SHFA_final ///
		OriginalCreditScore_reg I_mi_CreditScore log_OriginalPropertyValue log_hmda_income, ///
		cl(FIPS) absorb(fegroup)		
		estadd local ZipYearFE "Y"
		estadd local Controls "Y"
		estadd local Nobs =  e(N)
	
	eststo: reghdfe OriginalInterestRate I_SHFA_final ///
		OriginalCreditScore_reg I_mi_CreditScore log_OriginalPropertyValue log_hmda_income, ///
		cl(FIPS) absorb(fegroup)		
		estadd local ZipYearFE "Y"
		estadd local Controls "Y"
		estadd local Nobs = e(N)
		
	
	eststo: reghdfe I_del I_SHFA_final ///
		OriginalCreditScore_reg I_mi_CreditScore log_OriginalPropertyValue log_hmda_income, ///
		cl(FIPS) absorb(fegroup)		
		estadd local ZipYearFE "Y"
		estadd local Controls "Y"
		estadd local Nobs = e(N)
		

	esttab using "$repoutput/descriptivefacts.tex", b(4) se(4) ar2(2) keep(I_SHFA_final) ///
		star(* 0.10 ** 0.05 *** 0.01) ///
		stats(r2_a N, label("Adjusted \(R^{2}\)" "\midrule Observations") fmt(%9.2fc %9.0fc)) ///
		prehead("[1em]\midrule\multicolumn{4}{l}{\textit{Panel D: Includes Controls and Zip-Year Fixed Effects}} \\") ///  
		label append  nolines nodepvar nonumber  frag nomtitles noobs

		

**--------------------------------------------------------------------------------------------------------------------
** TABLE 3
**-----------------------------------------------------------------------------------------------------------------
	use "$repfinaldata/matchedloans_finalsample.dta", clear 
	
	label var OriginalLTV "LTV"
	label var OriginalInterestRate "Interest Rate"
	label var I_del "Delinquency"
	label var I_SHFA_final "FloodZone"
	label var I_r2 "CapBinds" 
	label var FloodZone_x_CapBinds "CapBinds $\times$ FloodZone"
	

	// Panel A 
	est drop _all 

	eststo: reg OriginalLTV I_r2 I_SHFA_final FloodZone_x_CapBinds , cl(FIPS) 
	estadd local FE "N"
	estadd local Controls "N"
	estadd local sample "Full"
	
	eststo: reghdfe OriginalLTV I_r2 I_SHFA_final FloodZone_x_CapBinds , cl(FIPS) absorb(fegroup)
	estadd local FE "Y"
	estadd local Controls "N"
	estadd local sample "Full"
	
	eststo: reghdfe OriginalLTV I_r2 I_SHFA_final FloodZone_x_CapBinds $restricted, cl(FIPS) absorb(fegroup)
	estadd local FE "Y"
	estadd local Controls "Y-restricted"
	estadd local sample "Full"
	
	eststo: reghdfe OriginalLTV I_r2 I_SHFA_final FloodZone_x_CapBinds $controls_ltv, cl(FIPS) absorb(fegroup)
	estadd local FE "Y"
	estadd local Controls "Y-full"
	estadd local sample "Full"
	
	esttab est1 est2 est3 est4 using "$repoutput/screening_aroundcap_ltv.tex", se(4) b(4) ar2(2) ///
		keep(I_r2 I_SHFA_final FloodZone_x_CapBinds) ///
		star(* 0.10 ** 0.05 *** 0.01) ///
		interaction(" $\times$ ")  ///
		stats(r2_a FE Controls N, label("Adjusted R-Squared" "Zip-Year FE" "Controls""Observations") fmt(%9.4f %9.0fc)) ///
		nomtitle nodepvar nonumbers nonotes nolines ///
		label replace frag 
		
	// Panel B 
	est drop _all 
		
	eststo: reg OriginalInterestRate I_r2 I_SHFA_final FloodZone_x_CapBinds, cl(FIPS) 
	estadd local FE "N"
	estadd local Controls "N"
	estadd local sample "Full"
	
	
	eststo: reghdfe OriginalInterestRate I_r2 I_SHFA_final FloodZone_x_CapBinds, cl(FIPS) absorb(fegroup)
	estadd local FE "Y"
	estadd local Controls "N"
	estadd local sample "Full"
	
	
	eststo: reghdfe OriginalInterestRate I_r2 I_SHFA_final FloodZone_x_CapBinds $restricted, cl(FIPS) absorb(fegroup)
	estadd local FE "Y"
	estadd local Controls "Y-restricted"
	estadd local sample "Full"
	
	eststo: reghdfe OriginalInterestRate I_r2 I_SHFA_final FloodZone_x_CapBinds $controls_ltv, cl(FIPS) absorb(fegroup)
	estadd local FE "Y"
	estadd local Controls "Y-full"
	estadd local sample "Full"
	
	esttab est1 est2 est3 est4 using "$repoutput/screening_aroundcap_rates.tex", se(4) b(4) ar2(2) ///
		keep(I_r2 I_SHFA_final FloodZone_x_CapBinds) ///
		star(* 0.10 ** 0.05 *** 0.01) ///
		interaction(" $\times$ ")  ///
		stats(r2_a FE Controls N, label("Adjusted R-Squared" "Zip-Year FE" "Controls""Observations") fmt(%9.4f %9.0fc)) ///
		nomtitle nodepvar nonumbers nonotes nolines ///
		label replace frag 
	
	
	// Panel C 
	est drop _all 
	
	eststo: reg I_del I_r2 I_SHFA_final FloodZone_x_CapBinds , cl(FIPS)
	estadd local FE "N"
	estadd local Controls "N"
	estadd local sample "Full"
	
	eststo: reghdfe I_del I_r2 I_SHFA_final FloodZone_x_CapBinds , cl(FIPS) absorb(fegroup)
	estadd local FE "Y"
	estadd local Controls "N"
	estadd local sample "Full"
		
	eststo: reghdfe I_del I_r2 I_SHFA_final FloodZone_x_CapBinds $restricted, cl(FIPS) absorb(fegroup)
	estadd local FE "Y"
	estadd local Controls "Y-restricted"
	estadd local sample "Full"


	eststo: reghdfe I_del I_r2 I_SHFA_final FloodZone_x_CapBinds $controls_ltv, cl(FIPS) absorb(fegroup)
	estadd local FE "Y"
	estadd local Controls "Y-full"
	estadd local sample "Full"

	esttab est1 est2 est3 est4 using "$repoutput/screening_aroundcap_delinq.tex", se(4) b(4) ar2(2) ///
		keep(I_r2 I_SHFA_final FloodZone_x_CapBinds) ///
		star(* 0.10 ** 0.05 *** 0.01) ///
		interaction(" $\times$ ")  ///
		stats(r2_a FE Controls N, label("Adjusted R-Squared" "Zip-Year FE" "Controls""Observations") fmt(%9.4f %9.0fc)) ///
		nomtitle nodepvar nonumbers nonotes nolines ///
		label replace frag 
		
	
		
**--------------------------------------------------------------------------------------------------------------------
** TABLE 4
**-----------------------------------------------------------------------------------------------------------------
	use $repfinaldata/eventstudy_parcel_FL13, clear 
	duplicates drop 
	duplicates report LoanId 
	drop if year_orig==2009 	
	
	//Balance Test Variables of Interest 
	gen I_2012 = (year_rev==2012)
	gen I_2013 = (year_rev==2013)
	gen I_2014 = (year_rev==2014)
	gen fz_grew3_noremap2 = fz_grew3 
	replace fz_grew3_noremap2 = 1 if noremap2==1 
	replace year_rev = 0 if noremap2==1
	
	*format variables 
	replace OriginalLTV = OriginalLTV * 100
	replace OriginalInterestRate = OriginalInterestRate*100 
	replace hmda_app_income = hmda_app_income * 1000 
	replace Jumbo = Jumbo * 100
	replace HMDA_denialrate = HMDA_denialrate * 100 
	replace takeup_SHFA = takeup_SHFA * 100
	replace takeup_noSHFA = takeup_noSHFA * 100 
	replace OriginalLoanAmount = OriginalLoanAmount / 1000 
	replace OriginalPropertyValue = OriginalPropertyValue / 1000 
	replace hmda_app_income = hmda_app_income / 1000 
	replace r2 = r2/10000 
	replace acs_num_hunits = acs_num_hunits / 1000 
	replace C_claim_mean = C_claim_mean / 1000
	replace OriginalCreditScore = . if I_mi_Credit==1
	
	// create labels 
	local OriginalLTV_lab "LTV (\\%)"
	local OriginalInterestRate_lab "Interest Rate (\\%)"
	local OriginalLoanAmount_lab "Loan Amount (\\$000s)"
	local OriginalPropertyValue_lab "Property Value (\\$000s)"
	local OriginalCreditScore_lab "Credit Score"
	local OriginalTerm_lab "Maturity (months)"
	local hmda_app_income_lab "Annual Income (\\$000s)"
	local CLTV_lab "Combined LTV (\\%)"
	local JumboAtOriginationFlag_lab "Jumbo Loan Share (\\%)"
	local r2_lab "Replacement Cost (\\$000s)"
	local rs_BuildingAreaSqFt_lab "Building Size (Square Feet)"

	local acs_num_hunits_lab "ACS Housing Units (000s)"
	local acs_pop_growth_lab "ACS Population Growth"
	local HMDA_denialrate_lab "HMDA Denial Rate (\\%)"
	local takeup_SHFA_lab "SFHA Takeup (\\%)"
	local takeup_noSHFA_lab "Non-SFHA Takeup (\\%)"
	local C_claim_mean_lab "Average Claim (\\$000s)"
	local count_loans_lab "Number of Loans"
	local count_zips_lab "Number of Zip Codes"

	*p-values for remapping in 2012 v 2013 v 2014
	foreach var in $balancevars {
		reg `var' I_2012 I_2013 I_2014 if fz_grew3==1 & year_orig==2010, cl(county) nocons
		testparm I_2012 I_2013 I_2014, equal 
		scalar pval_`var' = r(p)
		gen mean_`var' = `var'
		gen sd_`var' = `var'
	}
	
	*generate counts 
	keep if fz_grew3_noremap2==1 & year_orig == 2010 
	bys year_rev: gen mean_count_loans = _N 
	bys ZIP year_rev fz_grew3_noremap2: gen first_zips = (_n==1)
	bys year_rev fz_grew3_noremap2: egen mean_count_zips = sum(first_zips)

	
	collapse (mean) mean_*  (sd) sd_* , by(year_rev)
	local setobs1 = _N+1
	set obs `setobs1'
	tostring(year_rev), replace 
	replace year_rev = "pvalue" if _n==`setobs1' 
	foreach var in $balancevars {
		replace mean_`var' = pval_`var' if year_rev=="pvalue"
 		}
	
	reshape long mean_ sd_ , i(year_rev) j(stat) string
	reshape wide mean_ sd_ , i(stat) j(year_rev) string 

	
	gen order = .
	replace order = 1 if stat=="count_loans"
	replace order = 2 if stat=="OriginalLTV"
	replace order = 3 if stat=="OriginalInterestRate"
	replace order = 4 if stat=="OriginalLoanAmount"
	replace order = 5 if stat=="OriginalPropertyValue"
	replace order = 6 if stat=="OriginalTerm"
	replace order = 7 if stat=="OriginalCreditScore"
	replace order = 8 if stat=="hmda_app_income"
	replace order = 9 if stat=="CLTV"
	replace order = 10 if stat=="r2"
	replace order = 11 if stat=="rs_BuildingAreaSqFt"
	replace order = 12 if stat=="JumboAtOriginationFlag"
	replace order = 13 if stat=="count_zips"
	replace order = 14 if stat=="takeup_SHFA"
	replace order = 15 if stat=="takeup_noSHFA"
	replace order = 16 if stat=="C_claim_mean"
	replace order = 17 if stat=="acs_num_hunits"
	replace order = 18 if stat=="acs_pop_growth"
	replace order = 19 if stat=="HMDA_denialrate"

	
	sort order 
	drop order
	
	format mean* %9.3g
	format sd* %9.3g
	format mean_pval %9.2g
	drop mean_0 sd_0 sd_pvalue
	save "$repoutput/balancetable.dta", replace 
	
	texsave stat mean_2012 sd_2012 mean_2013 sd_2013 mean_2014 sd_2014 mean_pvalue using "$repoutput/balancetable.tex", nonames nofix frag ///
		title("Descriptive Statistics by Remapping Year for Loans Originated in 2010") ///
		headerlines("&\multicolumn{2}{c}{2012} & \multicolumn{2}{c}{2013} &\multicolumn{2}{c}{2014} & P-" ///
			    "& Mean & SD & Mean & SD & Mean & SD & Value") ///
		location(htp) replace 
	

**--------------------------------------------------------------------------------------------------------------------
** TABLE 5
**-----------------------------------------------------------------------------------------------------------------

	use $repfinaldata/eventstudy_parcel_FL13, clear 
	
	est drop _all 
	eststo: reghdfe OriginalLTV b9.event_time_y2 if fz_grew3==1, absorb(county year) cl(county)
	estadd local CountyFE = "Y"
	estadd local YearFE = "Y"
	estadd local BorrowerControls = "N"
	estadd local FloodInsuranceControls = "N"
	estadd local GSE = "N"
	eststo: reghdfe OriginalLTV b9.event_time_y2 log_hmda_income OriginalCreditScore_reg I_mi_Credit I_mi_income if fz_grew3==1, absorb(county year) cl(county)
	estadd local CountyFE = "Y"
	estadd local YearFE = "Y"
	estadd local BorrowerControls = "Y"
	estadd local FloodInsuranceControls = "N"
	estadd local GSE = "N"
	eststo: reghdfe OriginalLTV b9.event_time_y2 nfip_takeup  if fz_grew3==1, absorb(county year) cl(county)
	estadd local CountyFE = "Y"
	estadd local YearFE = "Y"
	estadd local BorrowerControls = "N"
	estadd local FloodInsuranceControls = "Y"
	estadd local GSE = "N"
	eststo: reghdfe OriginalLTV b9.event_time_y2 log_hmda_income OriginalCreditScore_reg I_mi_Credit I_mi_income nfip_takeup  if fz_grew3==1, absorb(county year) cl(county)
	estadd local CountyFE = "Y"
	estadd local YearFE = "Y"
	estadd local BorrowerControls = "Y"
	estadd local FloodInsuranceControls = "Y"
	estadd local GSE = "N"
	eststo: reghdfe log_income b9.event_time_y2 if fz_grew3==1, absorb(county year) cl(county)
	estadd local CountyFE = "Y"
	estadd local YearFE = "Y"
	estadd local BorrowerControls = "N"
	estadd local FloodInsuranceControls = "N"
	estadd local GSE = "N"	
	eststo: reghdfe OriginalCreditScore b9.event_time_y2 if fz_grew3==1, absorb(county year) cl(county)
	estadd local CountyFE = "Y"
	estadd local YearFE = "Y"
	estadd local BorrowerControls = "N"
	estadd local FloodInsuranceControls = "N"
	estadd local GSE = "N"
		
	esttab using "$repoutput/remappnig_eventstudy_dte.tex", se ar2 replace  ///
		rename(7.event_time_y2 "-3" 8.event_time_y2 "-2"  9.event_time_y2 "-1"   ///
			10.event_time_y2 "0" 11.event_time_y2 "1" 12.event_time_y2 "2" 13.event_time_y2 "3") /// 
		keep("-3" "-2" "-1" "0" "1" "2" "3") ///
		 star(* 0.10 ** 0.05 *** 0.01) ///
		stats(r2_a N CountyFE YearFE BorrowerControls FloodInsuranceControls, ///
		label("Adjusted R-Squared" "Observations" "County FE" "Year FE" "Borrower Controls" "Flood Insurance Controls") fmt(%9.4f %9.0fc)) ///
		nomtitle nodepvar nonumbers nonotes nolines ///
		frag 
						
**--------------------------------------------------------------------------------------------------------------------
** TABLE 6
**-----------------------------------------------------------------------------------------------------------------
	
	use $repfinaldata/eventstudy_parcel_FL13, clear 
	est drop _all 
	eststo: reghdfe OriginalInterestRate Post  if fz_grew3==1, absorb(county year) cl(county)
	estadd local CountyFE "Y"
	estadd local YearFE "Y"
	eststo: reghdfe I_del Post  if fz_grew3==1, absorb(county year) cl(county)
	estadd local CountyFE "Y"
	estadd local YearFE "Y"
	eststo: reghdfe DTI Post if fz_grew3==1, absorb(county year) cl(county)
	estadd local CountyFE "Y"
	estadd local YearFE "Y"
	eststo: reghdfe OriginalTerm Post if fz_grew3==1 , absorb(county year) cl(county)
	estadd local CountyFE "Y"
	estadd local YearFE "Y"
	eststo: reghdfe dollar_per_sqfoot Post if fz_grew3==1, absorb(county year) cl(county)
	estadd local CountyFE "Y"
	estadd local YearFE "Y"
		
	esttab using $repoutput/remapping_post_wrate.txt, se(4) b(4) ar2(2) replace  ///
		drop(_cons)  ///
		star(* 0.10 ** 0.05 *** 0.01) ///
		stats(r2_a CountyFE YearFE N, label("Adjusted R-Squared" "County FE" "Year FE" "Observations") fmt(%9.2f %9.0fc)) ///
		label varwidth(25) nonotes ///
		title("Pooled Effect of Updated Maps on Mortgages")
	
*-------------------------------------------------------
* TABLE 7
*-------------------------------------------------------	
	
	use $repfinaldata/eventstudy_parcel_FL13, clear 	
	
	label var OriginalLTV "LTV"
	label var OriginalInterestRate "Interest Rate"
	label var I_r2 "CapBinds"
			
	est drop _all 
	eststo: reghdfe OriginalLTV 1.Post 1.Post#1.I_r2 l_r2 if fz_grew3==1, absorb(county year) cl(county)
	estadd local CountyFE "Y"
	estadd local YearFE "Y"
	estadd local RepCostControl "Y"
	estadd local controls "N"
	eststo: reghdfe OriginalLTV 1.Post 1.Post#1.I_r2 l_r2  OriginalCreditScore_reg DTI_reg I_mi_Cr  I_mi_D if fz_grew3==1, absorb(county year) cl(county)
	estadd local CountyFE "Y"
	estadd local YearFE "Y"
	estadd local RepCostControl "Y"
	estadd local controls "Y"
	eststo: reghdfe OriginalInterestRate_ 1.Post 1.Post#1.I_r2 l_r2 I_mi_ra if fz_grew3==1, absorb(county year) cl(county)
	estadd local CountyFE "Y"
	estadd local YearFE "Y"
	estadd local RepCostControl "Y"
	estadd local controls "N"
	eststo: reghdfe OriginalInterestRate_ 1.Post 1.Post#1.I_r2 l_r2  OriginalCreditScore_reg DTI_reg I_mi_Cr I_mi_D I_mi_ra if fz_grew3==1, absorb(county year) cl(county)
	estadd local CountyFE "Y"
	estadd local YearFE "Y"
	estadd local RepCostControl "Y"
	estadd local controls "Y"
		
	esttab using $repoutput/remapping_post_cap.txt, se(4) b(4) ar2(2) ///
		replace ///
		star(* 0.10 ** 0.05 *** 0.01) ///
		stats(r2_a CountyFE YearFE RepCostControl controls N, ///
			label("Adjusted R-Squared" "County FE" "Year FE" "Replacement Cost Control" "Other Controls" "Observations") fmt(%9.2f %9.0fc)) ///
		label varwidth(25) nonotes ///
		keep(1.Post 1.Post#1.I_r2) 
		